/*
 * controlPanel.java
 *
 * Created on May 30, 2009, 5:12 PM
 */

package ca.biosample.robot.gui;

import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.LayoutStyle;

/**
 *
 * @author  mvs
 */
public class SourceControlPanel extends javax.swing.JPanel {

    /** Creates new form controlPanel */
    public SourceControlPanel(ActionListener listener) {
        initComponents();
        applySample.addActionListener(listener);
    }

    public String getCurrentSampleType() {
        return (String)sampleType.getSelectedItem();
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        sampleType = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        applySample = new javax.swing.JButton();

        //org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(cbsrobot.CBSRobotApp.class).getContext().getResourceMap(SourceControlPanel.class);
        setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Controls", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION)); // NOI18N
        setMaximumSize(new java.awt.Dimension(200, 600));
        setMinimumSize(new java.awt.Dimension(200, 600));
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(200, 600));

        sampleType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Whole Blood", "White Blood", "Plasma", "RNA", "Syrum", "Urine" }));
        //sampleType.setToolTipText(resourceMap.getString("sampleType.toolTipText")); // NOI18N
        sampleType.setName("sampleType"); // NOI18N

        jLabel1.setText("jLabel1Text"); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        applySample.setText("Apply"); // NOI18N
        //applySample.setToolTipText(resourceMap.getString("applySample.toolTipText")); // NOI18N
        applySample.setName("applySample"); // NOI18N

        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(sampleType, 0, 190, Short.MAX_VALUE)
            .addGroup((layout.createSequentialGroup()
                .addComponent(applySample)
                .addContainerGap()))
            .addGroup(layout.createSequentialGroup()
            	.addGap(8, 8, 8)
                .addComponent(jLabel1)
                .addContainerGap(99, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel1)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sampleType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(applySample)
                .addContainerGap(471, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton applySample;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JComboBox sampleType;
    // End of variables declaration//GEN-END:variables

}
